#include <bits/stdc++.h>

using namespace std;

int n,m,cnt = 0;
struct volunteer{
    int num;
    int score;
}a[5055];
bool cmp(volunteer a , volunteer b){
    if(a.score==b.score) return a.num<b.num;
    else return a.score>b.score;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i = 0 ; i < n ; i++){
        scanf("%d%d",&a[i].num,&a[i].score);
    }
    sort(a,a+n,cmp);
    for(int i = 0 ; a[i].score >=a[(int)(m*1.5-1)].score ; i++){
        cnt++;
    }
    cout<<a[(int)(m*1.5-1)].score<<' '<<cnt<<endl;
    for(int i = 0 ; a[i].score >=a[(int)(m*1.5-1)].score ; i++){
        cout<<a[i].num<<' '<<a[i].score<<endl;
    }
    return 0;
}
